package com.okr.okroperation.biz.service.nb;

import com.okr.okroperation.biz.service.dto.req.CalcSubReq;
import com.okr.okroperation.biz.service.dto.res.CalcSubRes;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class InterfaceMode {
    public CalcSubRes calculateSubtractOfTwoNumCom(CalcSubReq reqDto){
        CalcSubRes resData = new CalcSubRes();
        BigDecimal reqBig1 = new BigDecimal(reqDto.getCalcPara1().toString());
        BigDecimal reqBig2 = new BigDecimal(reqDto.getCalcPara2().toString());
        resData.setCalcResult(reqBig1.subtract(reqBig2).doubleValue());
        return resData;
    }

    public static void main(String[] args) {
        InterfaceMode o = new InterfaceMode();
        CalcSubReq reqDto = new CalcSubReq();
        reqDto.setCalcPara1(4.1d);
        reqDto.setCalcPara2(5.3d);
        CalcSubRes resDto = o.calculateSubtractOfTwoNumCom(reqDto);
        System.out.println(resDto.getCalcResult());
    }
}
